
import mxgraph from './graph/index';
const {
  mxGeometry,
  mxRectangle,
} = mxgraph;

export default {

  /**
   * 根据DI的Bounds信息 创建新的长方形范围
   *
   * @param imageDi
   * @returns {*}
   */
  newRectangleByDi(imageDi) {
    let diBounds = imageDi.getBounds();
    let width = diBounds ? diBounds.getWidth() : 0.0;
    let height = diBounds ? diBounds.getHeight() : 0.0;
    return  new mxRectangle(0, 0, width, height);
  },
  /**
   * 根据DI创建MxGeometry
   *
   * @param di
   * @returns {*}
   */
  newMxGeometryByDi(di) {
    let diBounds = di.getBounds();
    if (diBounds) {
      return new mxGeometry(
        di.getBounds().getX(),
        di.getBounds().getY(),
        di.getBounds().getWidth(),
        di.getBounds().getHeight()
      );
    } else {
      return new mxGeometry(0, 0, 0, 0);
    }
  },
  /**
   * 移动图形
   */
  moveDiShape() {

  },
  /**
   * 限定区域移动
   */
  limitAreaMove() {

  },
};
